package com.azthink.chapter422.controller;

import com.azthink.chapter422.domain.User;
import com.azthink.chapter422.utils.ResultVOUtils;
import com.azthink.chapter422.vo.ResultVO;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping(value = "/api/user")
public class UserController {

    //通过用户ID获取用户信息
    @RequestMapping(value = "/{id}")
    public ResultVO<User> get(@PathVariable Long id){
        //去调用业务逻辑层或数据持久层的查找用户方法
        User user = new User();
        user.setId(id);
        user.setUsername("admin");
        user.setNickname("系统管理员");
        user.setPassword("123456");
        user.setAge(18);
        return ResultVOUtils.success(user);
    }

}